import Vue from 'vue'
import App from './App.vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import router from "./router";
import store from "./store";
import VueI18n from 'vue-i18n'
import en from "./lang/en"
import zh from "./lang/zh"
import './permission';


Vue.config.productionTip = false

Vue.use(ElementUI);
Vue.use(VueI18n)

// 自定义一个指令  根据权限判断按钮显示
Vue.directive('permission',{
  inserted(el,binding){
    if (!binding.value.includes(store.getters.role)){
      el.parentNode.removeChild(el)
    }
  }
})
// 通过选项创建 VueI18n 实例
const i18n = new VueI18n({
  locale: localStorage.getItem('lang') || "zh",
  messages:{
    en,
    zh
  }
})
new Vue({
  router,
  store,
  i18n,
  render: h => h(App),
}).$mount('#app')
